package com.wanshi.controller;

import com.wanshi.po.Record;
import com.wanshi.po.Result;
import com.wanshi.service.RecordService;
import com.wanshi.service.TiService;
import com.wanshi.utils.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.Arrays;
import java.util.HashMap;
import java.util.UUID;

@SuppressWarnings("all")
@Controller
@RequestMapping("dati")
public class DatiController {

    @Autowired
    private TiService tiService;

    @Autowired
    private RecordService recordService;

    @RequestMapping(value = "/da")
    @ResponseBody
    public Result da(HttpSession session, int id, String content, String method) {
        //非空校验  如果答案是空,直接返回false
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);


        //记录, 不管,都要在记录表插入数据
        //id  自增 不用管
        // timu_id  前端传过来了
        // user_id  session中过去
        // result   判断之后才知道 暂时没有
        // content  前端传过来了
        // add_time   答题时间  时间戳格式 不用管
        Record record = RequestUtils.getRecord(session, id, content);

        //返回是 该题目的返回值类型
        DaTiUtils<Integer> daTiUtils = new DaTiUtils<>();

        //flag 用来记录  题目对错
        boolean flag = true;

        //生成了一个uuid. java文件的名称  也是class文件的名称
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            //核心来了, writeContent方法中是具体的判断代码
            int result = daTiUtils.writeContent(uuid, content, method, new Object[]{2, 3});
            //第一次判断
            flag = flag && result == 5;

            //如果flag是false
            if (!flag) {
                //把这条记录插入数据库 返回一个Result
                return RequestUtils.getResult(recordService, record, flag);
            }

            result = daTiUtils.writeContent(uuid, content, method, new Object[]{-1, -3});
            flag = flag && result == -4;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }


    @RequestMapping(value = "/test2")
    @ResponseBody
    public Result test2(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Integer> daTiUtils = new DaTiUtils<>();
        boolean flag = true;

        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int[] arr = new int[]{-1, -6, -7};

            int result = daTiUtils.writeContent(uuid, content, method, new Object[]{arr});
            flag = flag && result == -1;

            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            arr = new int[]{-6, -2, -7};
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{arr});
            flag = flag && result == -2;

        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }


    @RequestMapping(value = "/test3")
    @ResponseBody
    public Result test3(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<String> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            String param = "abcdefg";
            String result = daTiUtils.writeContent(uuid, content, method, new Object[]{param});
            flag = flag && ("gfedcba").equals(result);

            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            param = "abc";
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{param});
            flag = flag && ("cba").equals(result);

        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }


    @RequestMapping(value = "/test4")
    @ResponseBody
    public Result test4(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Integer> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int x = 6;
            int y = 7;
            Integer result = daTiUtils.writeContent(uuid, content, method, new Object[]{x, y});
            flag = flag && result == 7;
            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            x = 7;
            y = 6;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{x, y});
            flag = flag && result == 7;

        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }

    }


    @RequestMapping(value = "/test5")
    @ResponseBody
    public Result test5(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Integer> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            String str = "abcabca";
            char c = 'a';
            int result = daTiUtils.writeContent(uuid, content, method, new Object[]{str, c});
            flag = flag && result == 3;

            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            c = 'b';
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{str, c});
            flag = flag && result == 2;

        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }

    }


    @RequestMapping(value = "/test11")
    @ResponseBody
    public Result test11(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Double> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int[] arr = new int[]{1, 2, 3, 4, 5};
            Double result = daTiUtils.writeContent(uuid, content, method, new Object[]{arr});
            flag = flag && result == 3;

            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            arr = new int[]{2, 2, 2, 2, 2};
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{arr});
            flag = flag && result == 2;

        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }


    @RequestMapping(value = "/test12")
    @ResponseBody
    public Result test12(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Integer> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            String s1 = "abcabcab";
            String s2 = "ab";
            int result = daTiUtils.writeContent(uuid, content, method, new Object[]{s1, s2});
            flag = flag && result == 3;

            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            s1 = "abcabcab";
            s2 = "abc";
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{s1, s2});
            flag = flag && result == 2;

            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            s1 = "hhhhhhbbhhh";
            s2 = "hh";
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{s1, s2});
            flag = flag && result == 4;

        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test14")
    @ResponseBody
    public Result test14(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Integer> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int x = 10;
            int y = 15;
            int result = daTiUtils.writeContent(uuid, content, method, new Object[]{x, y});
            flag = flag && result == 5;

            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            x = 7;
            y = 9;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{x, y});
            flag = flag && result == 1;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test15")
    @ResponseBody
    public Result test15(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Integer> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int x = 10;
            int y = 15;
            int result = daTiUtils.writeContent(uuid, content, method, new Object[]{x, y});
            flag = flag && result == 30;

            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            x = 7;
            y = 9;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{x, y});
            flag = flag && result == 63;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test16")
    @ResponseBody
    public Result test16(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Integer> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int x = 2;
            int y = 3;
            int result = daTiUtils.writeContent(uuid, content, method, new Object[]{x, y});
            flag = flag && result == 246;

            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            x = 1;
            y = 3;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{x, y});
            flag = flag && result == 123;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }


    @RequestMapping(value = "/test17")
    @ResponseBody
    public Result test17(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Boolean> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int x = 49;
            boolean result = daTiUtils.writeContent(uuid, content, method, new Object[]{x});
            flag = flag && result == false;

            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            x = 7;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{x});
            flag = flag && result == true;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }


    @RequestMapping(value = "/test24")
    @ResponseBody
    public Result test24(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Integer> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int x = 4567;
            Integer result = daTiUtils.writeContent(uuid, content, method, new Object[]{x});
            flag = flag && result == 22;

            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            x = 2345;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{x});
            flag = flag && result == 14;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test25")
    @ResponseBody
    public Result test25(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<String> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            String ss = "  bg  mj k t";
            String result = daTiUtils.writeContent(uuid, content, method, new Object[]{ss});
            flag = flag && ("bgmjkt").equals(result);

            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            ss = "  bg";
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{ss});
            flag = flag && ("bg").equals(result);
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test26")
    @ResponseBody
    public Result test26(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<String> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            String s1 = "abcde";
            String s2 = "cd";
            String result = daTiUtils.writeContent(uuid, content, method, new Object[]{s1, s2});
            flag = flag && ("cd").equals(result);

            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            s1 = "abxcde";
            s2 = "zcdew";
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{s1, s2});
            flag = flag && ("cde").equals(result);
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test27")
    @ResponseBody
    public Result test27(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Boolean> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            String s1 = "abcabc";
            boolean result = daTiUtils.writeContent(uuid, content, method, new Object[]{s1});
            flag = flag  &&   result == false;

            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            s1 = "abfba";
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{s1});
            flag = flag && result == true;

            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            s1 = "n12n";
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{s1});
            flag = flag && result == false;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test28")
    @ResponseBody
    public Result test28(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Integer> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            Object arr = new int[][]{{1, 2}, {3}};
            int result = daTiUtils.writeContent(uuid, content, method, new Object[]{arr});
            flag = flag && result == 6;

            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            arr = new int[][]{{0, 2}, {3}};
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{arr});
            flag = flag && result == 5;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test29")
    @ResponseBody
    public Result test29(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Integer> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            Object arr = new int[][]{{1, 3}, {2}};
            int result = daTiUtils.writeContent(uuid, content, method, new Object[]{arr});
            flag = flag && result == 3;

            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            Object arr2 = new int[][]{{-10001}, {-10002}};
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{arr2});
            flag = flag && result == -10001;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test30")
    @ResponseBody
    public Result test30(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<int[]> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int[] arr = new int[]{1, 3, 2};
            int[] result = daTiUtils.writeContent(uuid, content, method, new Object[]{arr});
            flag = flag && Arrays.equals(result, new int[]{2, 3, 1});

            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            arr = new int[]{1, 3};
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{arr});
            flag = flag && Arrays.equals(result, new int[]{3, 1});
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test31")
    @ResponseBody
    public Result test31(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Integer> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int num = 345;
            int result = daTiUtils.writeContent(uuid, content, method, new Object[]{num});
            flag = flag && result == 12;

            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            num = 111;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{num});
            flag = flag && result == 3;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test32")
    @ResponseBody
    public Result test32(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Boolean> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int num = 34;
            boolean result = daTiUtils.writeContent(uuid, content, method, new Object[]{num});
            flag = flag && result == true;

            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            num = 111;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{num});
            flag = flag && result == false;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test33")
    @ResponseBody
    public Result test33(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Integer> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int num1 = 3;
            int num2 = 4;
            int num3 = 2;
            int result = daTiUtils.writeContent(uuid, content, method, new Object[]{num1, num2, num3});
            flag = flag && result == 4;

            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            num1 = 3;
            num2 = 1;
            num3 = 2;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{num1, num2, num3});
            flag = flag && result == 3;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test34")
    @ResponseBody
    public Result test34(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Integer> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int num1 = 10;
            int result = daTiUtils.writeContent(uuid, content, method, new Object[]{num1});
            flag = flag && result == 4;
            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            num1 = 11;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{num1});
            flag = flag && result == 7;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test35")
    @ResponseBody
    public Result test35(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Integer> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int[] arr = new int[]{1, 2, 3};
            int result = daTiUtils.writeContent(uuid, content, method, new Object[]{arr});
            flag = flag && result == 6;
            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            arr = new int[]{1, 2};
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{arr});
            flag = flag && result == 3;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test41")
    @ResponseBody
    public Result test41(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Integer> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int x = 2;
            int result = daTiUtils.writeContent(uuid, content, method, new Object[]{x});
            flag = flag && result == 3;
            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            x = 4;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{x});
            flag = flag && result == 10;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test42")
    @ResponseBody
    public Result test42(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Integer> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int x = 2;
            int result = daTiUtils.writeContent(uuid, content, method, new Object[]{x});
            flag = flag && result == 2;
            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            x = 5;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{x});
            flag = flag && result == 120;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test47")
    @ResponseBody
    public Result test47(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Boolean> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int x = 496;
            boolean result = daTiUtils.writeContent(uuid, content, method, new Object[]{x});
            flag = flag && result == true;
            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            x = 8;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{x});
            flag = flag && result == false;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test48")
    @ResponseBody
    public Result test48(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Integer> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            double x = 1.23;
            int result = daTiUtils.writeContent(uuid, content, method, new Object[]{x});
            flag = flag && result == 2;
            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            x = 8.88;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{x});
            flag = flag && result == 9;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test49")
    @ResponseBody
    public Result test49(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Integer> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            double x = 1.51;
            int result = daTiUtils.writeContent(uuid, content, method, new Object[]{x});
            flag = flag && result == 2;
            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            x = 5.49;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{x});
            flag = flag && result == 5;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test51")
    @ResponseBody
    public Result test51(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Double> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            double x = 1;
            double y = 3;
            double result = daTiUtils.writeContent(uuid, content, method, new Object[]{x, y});
            flag = flag && result == 1;
            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            x = 3;
            y = 3;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{x, y});
            flag = flag && result == 27;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test52")
    @ResponseBody
    public Result test52(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Double> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            double x = 8;
            double result = daTiUtils.writeContent(uuid, content, method, new Object[]{x});
            flag = flag && result == 2;
            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            x = 27;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{x});
            flag = flag && result == 3;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test53")
    @ResponseBody
    public Result test53(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Boolean> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int x = 12;
            boolean result = daTiUtils.writeContent(uuid, content, method, new Object[]{x});
            flag = flag && result == true;
            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            x = 18;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{x});
            flag = flag && result == false;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test54")
    @ResponseBody
    public Result test54(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Boolean> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int x = 2020;
            boolean result = daTiUtils.writeContent(uuid, content, method, new Object[]{x});
            flag = flag && result == true;
            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            x = 1900;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{x});
            flag = flag && result == false;
            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            x = 2002;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{x});
            flag = flag && result == false;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test56")
    @ResponseBody
    public Result test56(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Integer> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int x = 2020;
            int result = daTiUtils.writeContent(uuid, content, method, new Object[]{x});
            flag = flag && result == 4;
            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            x = 1900;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{x});
            flag = flag && result == 0;

        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test57")
    @ResponseBody
    public Result test57(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Integer> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int result = daTiUtils.writeContent(uuid, content, method, new Object[]{5});
            flag = flag && result == 9;
            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{8});
            flag = flag && result == 16;

        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test61")
    @ResponseBody
    public Result test61(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Integer> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int[] arr = new int[]{1, 3, 5, 4, 3};
            int x = 3;
            int result = daTiUtils.writeContent(uuid, content, method, new Object[]{arr, x});
            flag = flag && result == 1;
            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            arr = new int[]{1, 3, 5, 4, 3};
            x = 2;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{arr, x});
            flag = flag && result == -1;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test62")
    @ResponseBody
    public Result test62(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<int[]> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int[] arr = new int[]{1, 3, 5};
            int[] result = daTiUtils.writeContent(uuid, content, method, new Object[]{arr});
            flag = flag && Arrays.equals(result, new int[]{5, 3, 1});
            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            arr = new int[]{1, 3, 5, -4, -2};
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{arr});
            flag = flag && Arrays.equals(result, new int[]{5, 3, 1, -2, -4});
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test64")
    @ResponseBody
    public Result test64(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Integer> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            Object obj = new int[][]{{1, 2}, {3}};
            int result = daTiUtils.writeContent(uuid, content, method, new Object[]{obj});
            flag = flag && result == 3;
            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            obj = new int[][]{{1}};
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{obj});
            flag = flag && result == 1;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test65")
    @ResponseBody
    public Result test65(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Boolean> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int[] arr1 = new int[]{1, 2,4};
            int[] arr2 = new int[]{2, 1};
            boolean result = daTiUtils.writeContent(uuid, content, method, new Object[]{arr1, arr2});
            flag = flag && !Arrays.equals(arr1, arr2);
            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }

            arr1 = new int[]{1, 2,3,4,5};
            arr2 = new int[]{1, 2,3,4,6};
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{arr1, arr2});
            flag = flag && !Arrays.equals(arr1, arr2);
            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }

            arr1 = new int[]{2,5,7,1,2,3};
            arr2 = new int[]{2,5,7,1,2,3};
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{arr1, arr2});
            flag = flag && Arrays.equals(arr1, arr2);
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test66")
    @ResponseBody
    public Result test66(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<String> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int[] arr = new int[]{1, 3, 2};
            String result = daTiUtils.writeContent(uuid, content, method, new Object[]{arr});
            flag = flag && ("[1,3,2]").equals(result);
            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            arr = new int[]{1};
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{arr});
            flag = flag && ("[1]").equals(result);
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test67")
    @ResponseBody
    public Result test67(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<String> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int n = 4;
            String result = daTiUtils.writeContent(uuid, content, method, new Object[]{n});
            flag = flag && ("2/1,3/2,5/3,8/5").equals(result);
            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            n = 6;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{n});
            flag = flag && ("2/1,3/2,5/3,8/5,13/8,21/13").equals(result);
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test68")
    @ResponseBody
    public Result test68(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<String> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int n = 4;
            String result = daTiUtils.writeContent(uuid, content, method, new Object[]{n});
            flag = flag && ("8/5").equals(result);
            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            n = 6;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{n});
            flag = flag && ("21/13").equals(result);
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test69")
    @ResponseBody
    public Result test69(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<String> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            String ss = "xws.vn.txt";
            String result = daTiUtils.writeContent(uuid, content, method, new Object[]{ss});
            flag = flag && ("xws.vn_s.txt").equals(result);
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test70")
    @ResponseBody
    public Result test70(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<HashMap<Character, Integer>> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            String ss = "xxv";
            HashMap<Character, Integer> result = daTiUtils.writeContent(uuid, content, method, new Object[]{ss});
            flag = flag && result.get('x') == 2 && result.get('v') == 1;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

    @RequestMapping(value = "/test72")
    @ResponseBody
    public Result test72(HttpSession session, int id, String content, String method) {
        if (TextUtil.kong(content)) return new Result(Constants.ERROR);
        Record record = RequestUtils.getRecord(session, id, content);
        DaTiUtils<Integer> daTiUtils = new DaTiUtils<>();
        boolean flag = true;
        String uuid = UUID.randomUUID().toString().replace("-", "");
        try {
            int n = 9;
            int result = daTiUtils.writeContent(uuid, content, method, new Object[]{n});
            flag = flag && result == 1534;
            if (!flag) {
                return RequestUtils.getResult(recordService, record, flag);
            }
            n = 2;
            result = daTiUtils.writeContent(uuid, content, method, new Object[]{n});
            flag = flag && result == 10;
        } catch (Exception e) {
            flag = false;
        } finally {
            ThreadPoolUtils.pool.execute(new AsynOprDatabaseUtil(recordService, record, flag,uuid));
            return RequestUtils.getResult(recordService, record, flag);
        }
    }

}
